package com.louis.gifplayer;

import android.graphics.Bitmap;

public class GifHandler {

    private long gifAddr;

    public GifHandler(String path) {
       gifAddr = loadPath(path);
    }

    public native long loadPath(String path);

    public native int getWidth(long ndkGif);

    public native int getHeight(long ndkGif);

    public native int updateFrame(long ndkGif, Bitmap bitmap);

    public native void release(long ndkGif);

    public int getWidth() {
        return getWidth(gifAddr);
    }

    public int getHeight() {
        return getHeight(gifAddr);
    }

    /**
     *
     * @param bitmap
     * @return 下一帧的播放时间
     */
    public int updateFrame(Bitmap bitmap) {
        return updateFrame(gifAddr,bitmap);
    }
}
